﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BangChietTinhAir.aspx.cs" Inherits="DLV.BackEnd.Pages.BangChietTinhAir" EnableEventValidation="false" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="DLV.Data.Entities" %>
<%@ Import Namespace="DLV.Library.Utilities" %>

<asp:content id="Content1" contentplaceholderid="placeHolderContent" runat="server">
 
    <style>
        .report {
            margin-top: 40px;
        }

        .head {
            width: 100%;
            overflow: hidden;
        }

            .head > .logo {
                width: 20%;
                float: left;
                margin-right: 1%;
            }

                .head > .logo img {
                    display: block;
                    margin: 0 auto;
                }

            .head > .table {
                width: 78%;
                float: right;
            }

                .head > .table > table {
                    width: 100%;
                    border-top: 1px solid #000;
                    border-left: 1px solid #000;
                }

                    .head > .table > table th {
                        padding: 10px 0;
                        font-size: 20px;
                        border-bottom: 1px solid #000;
                        border-right: 1px solid #000;
                        background-color: #F2DCDB;
                    }

                    .head > .table > table td {
                        padding: 7px;
                        border-bottom: 1px solid #000;
                        border-right: 1px solid #000;
                    }

        .service {
            width: 100%;
            margin-top: 20px;
        }

            .service > table {
                width: 100%;
                margin-bottom: 20px;
                border-top: 1px solid #000;
                border-left: 1px solid #000;
            }

                .service > table th {
                    padding: 5px 0;
                    border-bottom: 1px solid #000;
                    border-right: 1px solid #000;
                    background-color: #F2DCDB;
                }

                    .service > table th.first {
                        background-color: #92CDDC;
                        width: 8%;
                    }

                .service > table td {
                    padding: 7px;
                    border-bottom: 1px solid #000;
                    border-right: 1px solid #000;
                }

                .service > table .tr {
                    text-align: right;
                }

        div {
            margin: 0;
            padding: 0;
        }
    </style>
    
    <div class="report">
        <div class="head">
            <div class="logo">
                <a href="http://dulichviet.com.vn"><img src="/images/logo.png" /></a>
            </div>    
            <div class="table">
                <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <th colspan="4">BẢNG TÍNH GIÁ</th>
                    </tr>
                    <tr>
                        <td><b>Tên đoàn</b></td>
                        <td><%=tourInfo.TourName %></td>
                        <td><b>Code đoàn</b></td>
                        <td>DLV<%=tourInfo.TourId %></td>
                    </tr>
                    <tr>
                        <td><b>Loại hình đoàn</b></td>
                        <td><%=tourInfo.GroupType %></td>
                        <td><b>Loại tour</b></td>
                        <td><%=tourInfo.TourTypeName %></td>
                    </tr>
                    <tr>
                        <td><b>Điểm khởi hành</b></td>
                        <td><%=tourInfo.LocationName %></td>
                        <td><b>Hành trình</b></td>
                        <td><%=tourInfo.Schedule %></td>
                    </tr>
                    <tr>
                        <td><b>Số lượng khách</b></td>
                        <td class="edit-tourItem">
                            Người lớn:
                            <asp:Label class="lbTour" ID="lbQuantityAdultsTour" runat="server"></asp:Label> 
                            <asp:TextBox class="ctTour"  id="txtQuantityAdultsTour" runat="server" Width="50px"></asp:TextBox>
                            |
                            Trẻ em:
                            <asp:Label class="lbTour" ID="lbQuantityChildTour" runat="server"></asp:Label>
                            <asp:TextBox class="ctTour"  id="txtQuantityChildTour" runat="server" Width="50px"></asp:TextBox>
                            |
                             Trẻ nhỏ:
                            <asp:Label class="lbTour" ID="lbQuantityBabyTour" runat="server"></asp:Label>
                            <asp:TextBox class="ctTour"  id="txtQuantityBabyTour" runat="server" Width="50px"></asp:TextBox>
                        </td>
                       
                        <td><b>Đối tượng khách</b></td>
                        <td>Chọn đối tượng khách</td>
                    </tr>
                    <tr>
                        <td><b>Số hướng dẫn viên</b></td>
                        <td>Chọn số</td>
                        <td><b>Yêu cầu</b></td>
                        <td>Chọn loại HDV</td>
                    </tr>
                    <tr>
                        <td><b>Ngày khởi hành</b></td>
                        <td>
                            <asp:Label class="lbTour" ID="lbBeginDateTour" runat="server"></asp:Label>
                            
                            <asp:Label class="lbTour" ID="lbBeginHourTour" runat="server"></asp:Label>
                            
                            <asp:Label class="lbTour" ID="lbBeginMinuteTour" runat="server"></asp:Label>
                            <input class="ctTour" type="text" id="dteBeginDateTour" placeholder="Click để chọn ngày" readonly="readonly" runat="server" />
                            <asp:DropDownList class="ctTour" ID="ddlBeginHourTour" runat="server" Width="55px"></asp:DropDownList>
                            <asp:DropDownList class="ctTour" ID="ddlBeginMinuteTour" runat="server" Width="55px"></asp:DropDownList>
                        </td>
                        <td><b>Ngày kết thúc</b></td>
                        <td>
                            <asp:Label class="lbTour" ID="lbEndDateTour" runat="server"></asp:Label>
                            
                            <asp:Label class="lbTour" ID="lbEndHourTour" runat="server"></asp:Label>
                            
                            <asp:Label class="lbTour" ID="lbEndMinuteTour" runat="server"></asp:Label>
                            <input class="ctTour" type="text" id="dteEndDateTour" placeholder="Click để chọn ngày" readonly="readonly" runat="server" />
                            <asp:DropDownList class="ctTour" ID="ddlEndHourTour" runat="server" Width="55px"></asp:DropDownList>
                            <asp:DropDownList class="ctTour" ID="ddlEndMinuteTour" runat="server" Width="55px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td><b>Tổng số ngày</b></td>
                        <td>
                            <asp:Label class="lbTour" ID="lbTotalDayTour" runat="server"></asp:Label> 
                            <asp:TextBox class="ctTour" id="txtTotalDayTour" runat="server" Width="50px" ></asp:TextBox>
                        </td>
                        <td><b>Tổng số đêm</b></td>
                        <td>
                            <asp:Label class="lbTour" ID="lbTotalNightTour" runat="server"></asp:Label> 
                            <asp:TextBox class="ctTour" id="txtTotalNightTour" runat="server" Width="50px" ></asp:TextBox>
                        </td>
                    </tr>
                     <tr>
                        <td><b>Mùa</b></td>
                        <td><%=tourInfo.Season %></td>
                        <td><b>Thị trường</b></td>
                        <td><%=tourInfo.MartName %></td>
                    </tr>
                </table>
                
                <input  id="btnUpdateTour" type="button" value="Cập nhật" />
               
                <asp:LinkButton class="ctTour" ID="lbtSave" runat="server" Text="" onclick="lbtSave_Click" CssClass="toolbar">
					<input class="ctTour" id="btnSaveTour" type="button" value="Lưu"  />
                    </asp:LinkButton>
						 
				<asp:LinkButton class="ctTour" ID="lbtClose" runat="server" Text="" onclick="lbtClose_Click" 
                    CssClass="toolbar" CausesValidation="False">
					<input class="ctTour" id="btnCloseTour" type="button" value="Hủy" />
				</asp:LinkButton>
						    

            </div>
        </div>
        <div class="service">
            <%-------------------------------------------------------------------------------------Máy bay------------%>
            <table cellpadding="0" cellspacing="0" border="0" id="table-air">
                
                <tr>
                    <th rowspan="2" class="first">MAY BAY </th>
                    <th rowspan="2">HÀNH TRÌNH</th>
                    <th rowspan="2">NGÀY ĐI</th>
                    <th rowspan="2">LƯỢT BAY</th>
                    <th rowspan="2">NHÀ CUNG CẤP</th>
                    <th rowspan="2">VÉ</th>
                    <th colspan="3">GIÁ/HẠNG VÉ/KHOANG</th>
                    <th colspan="3">SỐ KHÁCH</th>
                    <th rowspan="2">VAT</th>
                    <th rowspan="2">TỔNG CHI PHÍ</th>
                    <th rowspan="2">GHI CHÚ</th>
                    <th rowspan="2"></th>
                </tr>
                <tr>
                    <th>NGƯỜI LỚN</th>
                    <th>TRẺ EM</th>
                    <th>TRẺ NHỎ</th>
                    <th>NGƯỜI LỚN</th>
                    <th>TRẺ EM</th>
                    <th>TRẺ NHỎ</th>
                </tr>
                
                <% foreach (DLV.Data.Entities.GroupTourInfo calculatorAir in GroupAirs)
                   { %>
                <tr class="ListAir" id="group-air-<%=calculatorAir.GroupTourId%>">
                     <td colspan="16"><%=calculatorAir.GroupTourName %></td>
               
                   <%-- <td></td>
                    <td><%=calculatorAir.ScheduleName %></td>
                    <td><%=calculatorAir.DateBegin %></td>
                    <td ><%=calculatorAir.FlightArrivals %></td>
                    <td><%=calculatorAir.ConcernFullName %></td>
                    <td> <%=calculatorAir.TicketName %></td>
                     <td ><%=calculatorAir.PriceAdults.ToString("#,###", new CultureInfo("vi-VN")) %></td>
                    <td ><%=calculatorAir.PriceChild.ToString("#,###", new CultureInfo("vi-VN")) %></td>
                    <td ><%=calculatorAir.PriceBaby.ToString() %></td>
                    <td><%=calculatorAir.QuantityAdults %></td>
                    <td ><%=calculatorAir.QuantityChild %></td>
                    <td ><%=calculatorAir.QuantityBaby %></td>
                    <td><%=calculatorAir.Vat %></td>
                    <td ><%=(calculatorAir.TotalPriceStationAdults+calculatorAir.TotalPriceStationChild+calculatorAir.TotalPriceStationBaby).ToString("#,###", new CultureInfo("vi-VN")) %></td>
                    
                    <td></td>
                    <td>
                        <input class="btnUpdateAir" onclick="openPopup('ticket-air')"  type="button" value="Cập nhật" calculatorid="<%=calculatorAir.CalculatorId %>" />
                        <input class="btnDeleteAir"  type="button" value="Xóa" calculatorid="<%=calculatorAir.CalculatorId %>" />
                    </td>--%>
                </tr>
                <% } %>
               <tr id="new-group-air">
                    <td colspan="16"><b><input id="openPopupGroupAir" onclick="openPopup('group-air')" type="button"  value="Them Group" /></b></td>
                </tr>
                <tr id="new-ticket-air">
                    <td></td>
                    <td colspan="15"><b><input id="openPopupAir" onclick="openPopup('ticket-air')" type="button"  value="Them Lich Trinh" /></b></td>
                </tr>
                <tr>
                    
                    <td colspan="13"><b>TỔNG CHI PHÍ/ KHÁCH NGƯỜI LỚN</b></td>
                    <td class="tr" id="TotalTicketAirPricesAdults"><%=(int)TotalTicketAirPricesAdults%></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    
                    <td colspan="13"><b>TỔNG CHI PHÍ/ KHÁCH TRẺ EM</b></td>
                    <td class="tr" id="TotalTicketAirPricesChild"><%=(int)TotalTicketAirPricesChild %></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    
                    <td colspan="13"><b>TỔNG CHI PHÍ/ KHÁCH TRẺ NHỎ</b></td>
                    <td class="tr" id="TotalTicketAirPricesBaby"><%=(int)TotalTicketAirPricesBaby %></td>
                    <td></td>
                    <td></td>
                </tr>
                 <tr>
                    
                    <td colspan="13"><b>TỔNG CHI PHÍ ĐOÀN</b></td>
                    <td class="tr" id="TotalTicketAirPrices"><%=(int)TotalTicketAirPrices %></td>
                    <td></td>
                    <td></td>
                </tr>
            </table>
            
        </div>
    </div>
    
        <link href="/css/popup.css" rel="stylesheet" />
        <script src="/js/jquery.popup.js"></script>
        <div class="popup-wrapper"></div>
        <div class="popup-main popup-ticket-air">
        <div class="popup-content">
            <div class="m" style="float:left; width:100%">
                <div class="admin-left">
                    <%--<script type="text/javascript">
                        $(document).ready(function () {
                            var replaceCharacter = function (character) {
                                return character.replace('>', '&gt;');
                            };
                            var replaceDot = function (value) {
                                for (var i = 0; i < 5; i++)
                                    value = value.replace('.', '');
                                return value;
                            };
                            var selectedOption = function (element, text) {
                                $(element).each(function () {
                                    if (replaceCharacter($(this).text()) == text)
                                        $(this).attr('selected', 'selected');
                                });
                            };
                            var setValueElement = function (element, value) {
                                $(element).val(value);
                            };
                           $('.edit').click(function () {
                                var itemId = $(this).attr('itemid');
                                var element = $('#ticket-air-' + itemId);
                                var scheduleName = element.find('.col-schedule-name').html();
                                var goDate = element.find('.col-go-date').html();
                                var ticketType = element.find('.col-ticket-type').html();
                                var name = element.find('.col-name').html();
                                var priceAdults = replaceDot(element.find('.col-adults').html());
                                var priceChild = replaceDot(element.find('.col-child').html());

                                selectedOption('.ticket-air #<%=ddlSchedule.ClientID %> option', scheduleName);
                            selectedOption('.ticket-air #ddlTicketType option', ticketType);
                            setValueElement('.ticket-air #txtPriceAdults', priceAdults);
                            setValueElement('.ticket-air #txtPriceChild', priceChild);
                            setValueElement('.ticket-air #dteGoDate', goDate);
                            selectedOption('.ticket-air #ddlConcern option', name);
                        });
                        });
                    </script>--%>
                    <table class="adminform ticket-air">
                        <tr >
                            <td>HÀNH TRÌNH</td>
                            <td >
                                <asp:DropDownList ID="ddlScheduleAir" runat="server" Width="100px"></asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>NGÀY ĐI</td>
                            <td ><input type="text" id="dteGoDateAir" placeholder="Click để chọn ngày" readonly="readonly" runat="server" /></td>
                        </tr>
                        <tr>
                            <td>LƯỢT BAY</td>
                            <td ><asp:DropDownList ID="ddlFlightArrivalsAir" runat="server" Width="100px"></asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td>HÃNG HK</td>
                            <td ><asp:DropDownList ID="ddlConcernAir" runat="server" Width="100px"></asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td>VÉ</td>
                            <td><asp:DropDownList ID="ddlTicketAir" runat="server" Width="100px"></asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td>GIÁ VÉ NGƯỜI LỚN</td>
                            <td ><asp:TextBox id="txtPriceAdultAir" runat="server" Width="50px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>GIÁ VÉ TRẺ EM</td>
                            <td ><asp:TextBox id="txtPriceChildAir" runat="server" Width="50px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>GIÁ VÉ TRẺ NHO</td>
                            <td ><asp:TextBox id="txtPriceBabyAir" runat="server" Width="50px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>SO LUONG NGUOI LON</td>
                            <td ><asp:TextBox id="txtQuantityAdultsAir" runat="server" Width="50px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>SO LUONG TRE EM</td>
                            <td ><asp:TextBox id="txtQuantityChildAir" runat="server" Width="50px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>SO LUONG TRE NHO</td>
                            <td ><asp:TextBox id="txtQuantityBabyAir" runat="server" Width="50px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>VAT</td>
                            <td><asp:TextBox id="txtVatAir" runat="server" Width="100px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>TỔNG CHI PHÍ</td>
                            <td><asp:TextBox id="txtTotalPriceAir" runat="server" Width="100px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>GHI CHU</td>
                            <td><asp:TextBox runat="server" TextMode="MultiLine"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td id="toolbar-save" class="button">
                                <input  id="btnInsertAir" type="button" value="Thêm" calculatorid="-1"/>
                                <input id="btnDeleteAir" class="btnDeleteAir"  type="button" value="hủy" calculatorid="-1" />
                            </td>
                        </tr>
                        
                    </table>
                </div>
            </div>
        </div>
    </div>  
    <div class="popup-main popup-group-air">
        <div class="popup-content">
            <div class="m" style="float:left; width:100%">
                <div class="admin-left">
                    <table class="adminform ticket-air">
                        <tr >
                            <td>Tên Group</td>
                            <td >
                                <asp:TextBox ID="txtGroupName" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td >
                                <input  id="btnInsertGroup" type="button" value="Thêm" calculatorid="-1"/>
                                <input id="btnDeleteGroup" class="btnDeleteGroup"  type="button" value="hủy" calculatorid="-1" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>  
    <link rel="stylesheet" href="/css/datepicker/jquery.ui.all.css" />
	<script type="text/javascript" src="/js/ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="/js/ui/jquery.ui.datepicker.js"></script>
	<script type="text/javascript">
	    $(function () {
	        $("#<%= dteBeginDateTour.ClientID %>").datepicker({
	            changeMonth: true,
	            changeYear: true,
	            dateFormat: "dd/mm/yy"
	        });
	        $("#<%= dteEndDateTour.ClientID %>").datepicker({

	            changeMonth: true,
	            changeYear: true,
	            dateFormat: "dd/mm/yy"
	        });
	        $("#<%= dteGoDateAir.ClientID %>").datepicker({
	            changeMonth: true,
	            changeYear: true,
	            dateFormat: "dd/mm/yy"
	        });
	    });
	</script>
    <script src="../js/jquery.ChietTinhTour.js"></script>
    <script src="/js/jquery.ChietTinh.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {

            CalculatorTour('#<%=txtQuantityAdultsTour.ClientID%>', '#<%=txtQuantityChildTour.ClientID%>', '#<%=txtQuantityBabyTour.ClientID%>',
                '#<%=dteBeginDateTour.ClientID%>', '#<%=ddlBeginHourTour.ClientID%>', '#<%=ddlBeginMinuteTour.ClientID%>',
                '#<%=dteEndDateTour.ClientID%>', '#<%=ddlEndHourTour.ClientID%>', '#<%=ddlEndMinuteTour.ClientID%>',
                '#<%=txtTotalDayTour.ClientID%>', '#<%=txtTotalNightTour.ClientID%>',
                '<%=tourInfo.QuantityAdult%>', '<%=tourInfo.QuantityChild%>', '<%=tourInfo.QuantityBaby%>',
                '<%=tourInfo.BeginDate.ToShortDateString()%>', '<%=tourInfo.BeginDate.Hour%>', '<%=tourInfo.BeginDate.Minute%>',
                '<%=tourInfo.EndDate.ToShortDateString()%>', '<%=tourInfo.EndDate.Hour%>', '<%=tourInfo.EndDate.Minute%>',
                '<%=tourInfo.QuantityDay%>', '<%=tourInfo.QuantityNight%>');



            CalculatorAir('#<%= txtTotalPriceAir.ClientID%>', '#<%= ddlScheduleAir.ClientID%>',
                '#<%= ddlFlightArrivalsAir.ClientID%>', '#<%= ddlConcernAir.ClientID%>',
                '<%= tourInfo.TourId %>', '#<%=ddlTicketAir.ClientID%>',
                '#<%=txtPriceAdultAir.ClientID%>', '#<%=txtPriceChildAir.ClientID%>',
                '#<%=dteGoDateAir.ClientID%>', '#<%=txtVatAir.ClientID%>',
                '<%= tourInfo.Season%>', '#<%= txtQuantityAdultsAir.ClientID%>',
                '#<%= txtQuantityChildAir.ClientID%>', '#<%=txtPriceBabyAir.ClientID%>',
                '#<%=txtQuantityBabyAir.ClientID%>');

            GroupTour('#<%=txtGroupName.ClientID%>');
        });
    </script>
</asp:content>
